/* GUI CONVERTED from rspomta.p (converter v1.76) Thu May 23 14:10:15 2002 */
/* rspomta.p - Release Management Scheduled Order Maintenance                 */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.7.2.7 $                                                       */
/*V8:ConvertMode=Maintenance                                                  */
/* REVISION: 7.3    LAST MODIFIED: 10/09/92           BY: WUG *G462*          */
/* REVISION: 7.3    LAST MODIFIED: 05/24/93           BY: WUG *GB29*          */
/* REVISION: 7.3    LAST MODIFIED: 09/22/94           BY: ljm *GM77*          */
/* REVISION: 7.3    LAST MODIFIED: 10/31/94           BY: WUG *GN76*          */
/* REVISION: 7.3    LAST MODIFIED: 03/23/95           BY: bcm *G0J1*          */
/* REVISION: 7.3    LAST MODIFIED: 10/30/95           BY: vrn *G0ZX*          */
/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane          */
/* REVISION: 8.6E     LAST MODIFIED: 05/20/98   BY: *K1Q4* Alfred Tan         */
/* REVISION: 8.6E     LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan         */
/* REVISION: 9.1      LAST MODIFIED: 10/01/99   BY: *N014* Patti Gaultney     */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane   */
/* REVISION: 9.1      LAST MODIFIED: 05/12/00   BY: *N09X* Antony Babu        */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00   BY: *N0KP* myb                */
/* Old ECO marker removed, but no ECO header exists *F0PN*                    */
/* $Revision: 1.7.2.7 $   BY: Jean Miller        DATE: 05/22/02  ECO: *P074*  */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/

/* SCHEDULED ORDER MAINT SUBPROGRAM */

{mfdeclre.i}
{gplabel.i} /* EXTERNAL LABEL INCLUDE */

define input parameter to_pod_recid as recid.

define variable i as integer.
define buffer cmtdet for cmt_det.
define buffer from_pod for pod_det.
define buffer to_pod for pod_det.
define buffer from_po for po_mstr.
define buffer to_po for po_mstr.
define variable frtitle as character.

find to_pod where recid(to_pod) = to_pod_recid exclusive-lock.
find to_po where to_po.po_nbr = to_pod.pod_nbr no-lock.

frtitle = " " + getTermLabel("COPY_FROM_ORDER",22) + ": " +
          to_pod.pod_nbr + "  " + getTermLabel("ITEM",8) + ": " +
          to_pod.pod_part + " ".


/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
   
 RECT-FRAME       AT ROW 1.4 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1   COLUMN 3 NO-LABEL
 SKIP(.1)  /*GUI*/
scx_shipto           colon 16 label "Ship-To Site"
   si_desc              no-label
   scx_line             colon 68
 SKIP(.4)  /*GUI*/
with frame a width 80 attr-space side-labels overlay row 9 column 1
 NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER.
 F-a-title = frtitle.
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:WIDTH-PIXELS in frame a =
  FONT-TABLE:GET-TEXT-WIDTH-PIXELS(
  RECT-FRAME-LABEL:SCREEN-VALUE in frame a + " ", RECT-FRAME-LABEL:FONT).
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5. /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).

do on endkey undo, leave:
   do with frame a:

      global_part = to_pod.pod_part.

      prompt-for
         scx_shipto scx_line
      editing:

         if frame-field = "scx_shipto" then do:

            {mfnp05.i scx_ref scx_po "scx_type = 2
                 and scx_po = to_pod.pod_nbr and scx_part = to_pod.pod_part"
               scx_shipto "input scx_shipto"}

            if recno <> ? then do:
               find si_mstr where si_site = scx_shipto no-lock.
               find from_pod where from_pod.pod_nbr = scx_order
                  and from_pod.pod_line = scx_line no-lock.

               global_site = from_pod.pod_site.

               display
                  scx_shipto
                  si_desc
                  scx_line.
            end.

         end.

         else
         if frame-field = "scx_line" then do:

            {mfnp05.i scx_ref scx_order "scx_type = 2
                 and scx_order = to_pod.pod_nbr"
               scx_line "input scx_line"}

            if recno <> ? then do:
               find si_mstr where si_site = scx_shipto no-lock.
               find from_pod where from_pod.pod_nbr = scx_order
                  and from_pod.pod_line = scx_line no-lock.

               global_site = from_pod.pod_site.

               display
                  scx_shipto
                  si_desc
                  scx_line.
            end.

         end.

         else do:
            status input.
            readkey.
            apply lastkey.
         end.

      end.

      if scx_line entered then do:

         find from_pod where from_pod.pod_nbr = to_po.po_nbr
                         and from_pod.pod_line = input scx_line
         no-lock no-error.

         if available from_pod then do:
            global_site = from_pod.pod_site.
            display
               from_pod.pod_site @ scx_shipto.
         end.

      end.

      find scx_ref where scx_type = 2 and
                         scx_shipfrom = to_po.po_vend and
                         scx_shipto = input scx_shipto and
                         scx_part = to_pod.pod_part and
                         scx_po = to_pod.pod_nbr
      no-lock no-error.

      if not available scx_ref then do:
         /* Scheduled Order detail record does not exist */
         {pxmsg.i &MSGNUM=8172 &ERRORLEVEL=3}
         undo, retry.
      end.

      find si_mstr where si_site = scx_shipto no-lock.

      display
         scx_shipto
         si_desc
         scx_line.
   end.

   find from_pod where from_pod.pod_nbr = scx_order
      and from_pod.pod_line = scx_line no-lock.

   find from_po where from_po.po_nbr = from_pod.pod_nbr no-lock.

   assign
      to_pod.pod_pr_list = from_pod.pod_pr_list
      to_pod.pod_acct = from_pod.pod_acct
      to_pod.pod_sub = from_pod.pod_sub
      to_pod.pod_cc = from_pod.pod_cc
      to_pod.pod_taxable = from_pod.pod_taxable
      to_pod.pod_taxc = from_pod.pod_taxc
      to_pod.pod_cst_up = from_pod.pod_cst_up
      to_pod.pod_loc = from_pod.pod_loc
      to_pod.pod_firm_days = from_pod.pod_firm_days
      to_pod.pod_plan_days = from_pod.pod_plan_days
      to_pod.pod_plan_weeks = from_pod.pod_plan_weeks
      to_pod.pod_plan_mths = from_pod.pod_plan_mths
      to_pod.pod_fab_days = from_pod.pod_fab_days
      to_pod.pod_raw_days = from_pod.pod_raw_days
      to_pod.pod_translt_days = from_pod.pod_translt_days
      to_pod.pod_sftylt_days = from_pod.pod_sftylt_days
      to_pod.pod_vpart = from_pod.pod_vpart
      to_pod.pod_sd_pat = from_pod.pod_sd_pat
      to_pod.pod_qty_ord = from_pod.pod_qty_ord
      to_pod.pod_cum_qty[3] = from_pod.pod_cum_qty[3]
      to_pod.pod_ord_mult = from_pod.pod_ord_mult
      to_pod.pod_cum_date[1] = from_pod.pod_cum_date[1]
      to_pod.pod_cum_date[2] = from_pod.pod_cum_date[2]
      to_pod.pod_cum_date[3] = from_pod.pod_cum_date[3]
      to_pod.pod_type = from_pod.pod_type
      to_pod.pod_wo_lot = from_pod.pod_wo_lot
      to_pod.pod_op = from_pod.pod_op.

   if from_pod.pod_cmtindx > 0 then do:
      {gpcmtcpy.i
         &old_index=from_pod.pod_cmtindx
         &new_index=to_pod.pod_cmtindx
         &counter=i}
   end.
end.

hide frame a no-pause.
